<?php
namespace app\crm\model;

use think\Model;
use think\Db;
use think\Cache;


class Pbx extends Model
{ 
	public function call1()
	{
		$customer_code = $_REQUEST["customer_code"];
		$src_exten = $_REQUEST["src_exten"];
		$phone = Db::name('vip_customer_basic')->field("phone")->where("customer_code ='$customer_code'")->find();
		$file_contents = file_get_contents('http://192.168.88.59:8888/index.php?m=Interface&a=calls&src_exten='.$src_exten.'&dst_exten='.$phone['phone']);
		
		echo "ok";
	}

    // 从外呼打电话
    public function call_outbound()
    {
        $customer_code = $_REQUEST["customer_code"];
        $id = $_REQUEST['id'];
        $src_exten = $_REQUEST["src_exten"];
        $phone = Db::table("bgcrm.sales_source_$id")->field("phone1")->where("customer_code ='$customer_code'")->find();
        // print_r('http://192.168.88.59:8888/index.php?m=Interface&a=calls&src_exten='.$src_exten.'&dst_exten='.$phone['phone1']);exit;
        $file_contents = file_get_contents('http://192.168.88.59:8888/index.php?m=Interface&a=calls&src_exten='.$src_exten.'&dst_exten='.$phone['phone1']);
        
        echo "ok";
    }

}


?>